#if 0
static void queuetest_task(void *arg)
{
    char *rx_buffer_ptr;
    static int queuetest_task_cnt=0;
    static int rcv_cnt=0;
    while(1)
    {
        printf("queuetest_task:%d\r\n",queuetest_task_cnt++);
        //checkQueueForData();
       // printTaskList();
        if (xQueueReceive(uart_to_udp_queue, &rx_buffer_ptr, portMAX_DELAY) == pdTRUE) 
            {

                printf("xQueueReceive,rcv_cnt:%d\r\n",rcv_cnt++);
                //printf("rx_buffer:%s \r\n",rx_buffer_ptr);
                ESP_LOGI(TAG, "Received message: %s", rx_buffer_ptr);
            }
      vTaskDelay(200 /portTICK_PERIOD_MS);
    }

}
/*-----------------------------------------------------------------*/
// 发送任务
void sender_task(void *pvParameters)
{
    int count = 0;
    while (1)
    {
        // 动态分配内存
        char *message = (char *)malloc(50); // 假设最多20个字符

        // 构建带计数的字符串
        snprintf(message, 30, "Hello, world! %d", count);

        // 向队列发送数据
        if (xQueueSend(uart_to_udp_queue, &message, portMAX_DELAY) == pdPASS)
        {
            ESP_LOGI(TAG, "Message sent to queue");
        }

        // 增加计数器
        count++;

        vTaskDelay(pdMS_TO_TICKS(1000)); // 每秒发送一次
    }
}

// 接收任务
void receiver_task(void *pvParameters)
{
    char *rx_message;
    while (1)
    {
        if (xQueueReceive(uart_to_udp_queue, &rx_message, portMAX_DELAY) == pdPASS)
        {
            ESP_LOGI(TAG, "Received message: %s", rx_message);
            // 释放内存
            free(rx_message);
        }
    }
}


void showtaskinfo(void *pvParameters)
{
    TaskHandle_t tmp_handle;
    TaskStatus_t xTaskDetails;

    tmp_handle= xTaskGetHandle("uartrecieve");

    while(1)
    {
     vTaskGetInfo(tmp_handle,&xTaskDetails,1,eInvalid);
    //printf("taskname:%s,  tasknumber:%d,  currentstate=%d,  currentprior=%d,  baseprior=%d, runtimecounter=%d stackwatermark=%d",
    printf("taskname:%s,  tasknumber:%d,  currentstate=%d,  currentprior=%d,   runtimecounter=0 ", 
    xTaskDetails.pcTaskName, xTaskDetails.xTaskNumber, xTaskDetails.eCurrentState, xTaskDetails.uxCurrentPriority);
     vTaskDelay(pdMS_TO_TICKS(1000));

    }
  
}
#endif